import request from '@/utils/request'

// 查询广告管理列表
export function listAdvertise(query) {
  return request({
    url: '/system/advertise/list',
    method: 'get',
    params: query
  })
}

// 查询广告管理详细
export function getAdvertise(id) {
  return request({
    url: '/system/advertise/' + id,
    method: 'get'
  })
}

// 广告状态修改
export function changeUserStatus(id, stat) {
  const data = {
    id,
    stat
  }
  return request({
    url: '/system/advertise/changeStatus',
    method: 'put',
    data: data
  })
}

// 新增广告管理
export function addAdvertise(data) {
  return request({
    url: '/system/advertise',
    method: 'post',
    data: data
  })
}

// 修改广告管理
export function updateAdvertise(data) {
  return request({
    url: '/system/advertise',
    method: 'put',
    data: data
  })
}

// 删除广告管理
export function delAdvertise(id) {
  return request({
    url: '/system/advertise/' + id,
    method: 'delete'
  })
}


// export function searchByPOI(keywords) {
//   let data = {
//     keyword: keywords,
//     key: 'BGTBZ-2DN63-UBJ3O-OMVSL-IGFHF-47FRI'
//   }
//   return request({
//     url: 'https://apis.map.qq.com/ws/place/v1/suggestion',
//     method: 'GET',
//     query: data
//   })
// }

export function searchByPOI(keywords) {
  console.log(keywords)
  return request({
    url: '/api/advertise/getAddress?keyword='+keywords,
    method: 'GET',
  })
}
